package com.gxa.day2022_07_29_21.homework.order_system_4.memory_store;

import com.gxa.day2022_07_29_21.homework.order_system_4.model.Dish;
import com.gxa.day2022_07_29_21.homework.order_system_4.model.Order;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Author: zhuiyi
 * @CreatTime: 2022/7/30 15:24
 **/
public class MemoryStore {//假装一下数据库，实际是存内存的
    //存放菜品信息
    public static List<Dish> dishes = new ArrayList<>();
    //存放订单信息
    public static  List<Order> orders = new ArrayList<>();

    /**
     * staic 代码块 比main方法还先执行，用于初始化一些数据
     */
    static {
        //初始化菜单
        dishes.add(new Dish(1,"鱼香肉丝",23.0,108));
        dishes.add(new Dish(2,"红烧带鱼",33.0,176));
        dishes.add(new Dish(3,"时令鲜蔬",13.0,88)) ;
        //初始化一个订单
        orders.add(new Order("张三","红烧带鱼 2份",12,"云华路333号",66));
    }
}
